//
//  ZYAddView.m
//  Tourism
//
//  Created by 张亚 on 16/1/23.
//  Copyright © 2016年 zhikuiyu. All rights reserved.
//

#import "ZYAddView.h"
#import "ZYDrawDateView.h"
#import "ZYTableFormView.h"

#import <FSCalendar.h>

@interface ZYAddView ()<FSCalendarDelegate,FSCalendarDataSource>
{
    UIView * titleView;
    UIScrollView * scrView;
}

@end

@implementation ZYAddView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self configure];
    
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder{
    self = [super initWithCoder:aDecoder];
    if (self) {
        [self configure];
    }
    return self;
}

- (void)configure{
    self.backgroundColor = [UIColor clearColor];
    
    scrView = [[UIScrollView alloc]initWithFrame:self.bounds];
    scrView.backgroundColor = [UIColor clearColor];
    
    [scrView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"back2"]]];
    scrView.contentSize = CGSizeMake(0, 800);
    
    
    titleView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.bounds.size.width, 60)];
    CGFloat dateLaX = SCREEN_WIDTH / 2 - 100;
    UILabel * dateLabel = [[UILabel alloc]initWithFrame:CGRectMake(dateLaX, 0, 200, 60)];
    dateLabel.text = @"2016 - 01 - 25";
    dateLabel.textAlignment = NSTextAlignmentCenter;
    [titleView addSubview:dateLabel];
    
    UIButton * leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    leftBtn.frame = CGRectMake(48, 15, 30, 30);
    [leftBtn setImage:[UIImage imageNamed:@"左"] forState:0];
    [titleView addSubview:leftBtn];
    UIButton * rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    rightBtn.frame = CGRectMake(SCREEN_WIDTH - 100, 15, 30, 30);
    [rightBtn setImage:[UIImage imageNamed:@"右"] forState:0];

    [titleView addSubview:rightBtn];
    
    
    /*********************自己画出的日期日历格式*******************************
    ZYDrawDateView * drawView = [[ZYDrawDateView alloc]initWithFrame:CGRectMake(0,60,SCREEN_WIDTH, 300)];
    drawView.backgroundColor = [UIColor clearColor];
     ************************************************************************/
    
    /*********************采用第三方库来调用日历格式*******************************/
    
    FSCalendar * fs = [[FSCalendar alloc]initWithFrame:CGRectMake(0,60,SCREEN_WIDTH, 300)];
    fs.delegate = self;
    fs.dataSource = self;
    /**************************************************************************/

    //画表格
    ZYTableFormView * tableForm = [[ZYTableFormView alloc]initWithFrame:CGRectMake(0, 380, SCREEN_WIDTH, 240)];
    tableForm.backgroundColor = [UIColor clearColor];
    
    UIButton * moreBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    moreBtn.frame = CGRectMake(30, 650, SCREEN_WIDTH - 60, 50);
    [moreBtn setTitle:@"添加更多" forState:UIControlStateNormal];
    [moreBtn setTitleColor:[UIColor blackColor] forState:0];
//    [moreBtn setImage:[UIImage imageNamed:@"添加"] forState:0];
    [moreBtn setBackgroundImage:[UIImage imageNamed:@"添加"] forState:0];
    [scrView addSubview:moreBtn];
    
    [scrView addSubview:titleView];
//    [scrView addSubview:drawView];
    [scrView addSubview:fs];
    [scrView addSubview:tableForm];
    
    [self addSubview:scrView];
}


@end
